package com.fagejiang;

import com.fagejiang.pojo.EsGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author 发哥讲Java
 * @version 1.0
 * @date 2021-03-18 14:03
 */
@RestController
public class TestController {
    @Autowired
    ElasticsearchRestTemplate elasticsearchTemplate;

    /**
     * 创建索引和映射
     */

    public void createIndexAndMapping() {
        //创建索引，会根据EsGoods类的@Document注解信息来创建
//        elasticsearchTemplate.createIndex(EsGoods.class);
        //配置映射，会根据EsGoods类中的id、Field等字段来自动完成映射
//        elasticsearchTemplate.putMapping(EsGoods.class);
    }
}
